﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cricket.LinqModel;
using System.Web.Services;
using Cricket.LinqData;

public partial class CricketAdmin : System.Web.UI.MasterPage
{
    static IDataRepository _dataObject1 = new DataRepository();
    static Client client;
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["Client"];
        if (!Page.IsPostBack)
        {
            if (cookie == null)
            {

                Response.Redirect("Logout.aspx");
            }
            else
            {
                lblwelcome.Text = ("Welcome " + cookie["FullName"]);
                fillMenu();
            }
        }
        cookie.Expires = DateTime.Now.AddMinutes(60);
        Response.Cookies.Set(cookie);
    }

    

    private void fillMenu()
    {
        ltrMenu.InnerHtml = "<ul class='page-sidebar-menu'>";
        ltrMenu.InnerHtml += "<li><div class='sidebar-toggler hidden-phone'></div></li>";
        ltrMenu.InnerHtml += "<li class=<%=Request.Url.AbsolutePath.Contains('dashboard.aspx')?'start active':'' %><a href='dashboard.aspx'><i class='icon-home'></i><span class='title'>DASHBOARD</span><span class='selected'></span></a></li>";
        

        ltrMenu.InnerHtml += "<li id='liMyProfile' runat='server'><a href='MyProfile.aspx'><i class='icon-shopping-cart'>";
        ltrMenu.InnerHtml += "</i><span class='title'>My Profile</span></a>";

        ltrMenu.InnerHtml += "<li id='liBetting' runat='server'><a href='javascript:;'><i class='icon-shopping-cart'>";
        ltrMenu.InnerHtml += "</i><span class='title'>Betting</span> <span class='arrow '></span></a>";
        ltrMenu.InnerHtml += "<ul class='sub-menu'>";
        ltrMenu.InnerHtml += "<li id='liBetting1' runat='server'><a href='Betting.aspx'>Betting</a></li>";
        ltrMenu.InnerHtml += "<li id='liToss' runat='server'><a href='Toss.aspx'>Toss</a></li>";
        ltrMenu.InnerHtml += "</ul></li>";


        ltrMenu.InnerHtml += "<li id='liReport' runat='server'><a href='javascript:;'><i class='icon-shopping-cart'>";
        ltrMenu.InnerHtml += "</i><span class='title'>Report</span> <span class='arrow '></span></a>";
        ltrMenu.InnerHtml += "<ul class='sub-menu'>";
        ltrMenu.InnerHtml += "<li id='liMatchR' runat='server'><a href='MatchReport.aspx'>Match</a></li>";
        ltrMenu.InnerHtml += "<li id='liSessionR' runat='server'><a href='SessionReport.aspx'>Session</a></li>";
        ltrMenu.InnerHtml += "<li id='li90110R' runat='server'><a href='NineEleven.aspx'>90-110</a></li>";
        ltrMenu.InnerHtml += "<li id='liCommissionR' runat='server'><a href='CommissionReport.aspx'>Commission</a></li>";
        ltrMenu.InnerHtml += "<li id='liLedgerR' runat='server'><a href='LedgerReport.aspx'>Ledger</a></li>";
        ltrMenu.InnerHtml += "</ul></li>";

        ltrMenu.InnerHtml += "<li class='last '><a href='Logout.aspx'><i class='icon-key'></i><span class='title'>Logout</span> </a></li>";
        ltrMenu.InnerHtml += "</ul></div>";
    }
}
